<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>登录</title>
  <style type="text/css">
  		table tr{
  			line-height: 30px;
  		}
  </style>
  <jsp:include page="common/common.jsp"></jsp:include>
 <script type="text/javascript">
 			$(function(){
 				$('#loginDialog').dialog({
 						title:"登录界面",
 						width:320,
 						height:200,
 						top:150,
 						iconCls:'icon-login',
 						closable:false,
 						modal:true,
						buttons:[{
								text:'登录',
								iconCls:'icon-ok',
								handler:function(){
								$.ajax({
									type:'POST',
									url:'admin/loginCheck',
									data:{"username":$('#username').val(),"password":$.md5($('#password').val()+$('#username').val())},
									dataType:'json',
									beforeSend:function(){
										$.messager.progress({
											msg:'登录',
											text:'登录中,请稍等...'
										});
									},
									success:function(data){
										if(data && data.success){
											$('#loginDialog').dialog('close');
											$.messager.progress('close');
											$.messager.show({
												title:'提示',
												msg:data.message
											});
											location.href='<%=basePath%>admin/index';
										}else{
												$.messager.progress('close');
												$.messager.alert('提示',data.message);
										}
									},
									error:function(data){
										$.messager.progress('close');
										$.messager.alert('提示',data.message);
									}
								});
								}
							},
							{
								text:'取消',
								iconCls:'icon-cancel',
								handler:function(){
									$('#loginForm input[name=username]').val('');
									$('#loginForm input[name=password]').val('');
								}
						}]

 				});
 			});
 	</script>
  </head>
  
  <body>  
  <div id="loginDialog" >
  	<form action="" id="loginForm" method="post">
  			<table align="center">
  					<tr>
  							<td>账号:</td>
  							<td ><input type="text" name="username" id="username" value="admin" style="width:160px "></td>
  					</tr>
  					<tr>
  							<td>密码:</td>
  							<td><input type="password" name="password" id="password" value="123456" style="width:160px "></td>
  					</tr>
  			</table>
  	</form>
  </div> 
</body> 
</html>
